<?php

/**
 * Description of EmailAddress
 *
 * @author  Ian Clarence ian.clarence@gmail.com
 */
class EmailAddress {

    /**
     * The constructor.
     *
     * @param string $emailAddress
     * @param string $displayName
     */
    public function __construct(
        $emailAddress = NULL,
        $displayName = NULL
    ) {
        $this->emailAddress = $emailAddress;
        $this->displayName = $displayName;
    }

    /**
     * Rendering the email address.
     */
    public function render() {
        if ($this->emailAddress == NULL) {
            return NULL;
        }
        if ($this->displayName == NULL) {
            return $this->emailAddress;
        }
        return $this->displayName . " <" . $this->emailAddress . ">";
    }
}
